package design;

import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;

class GuavaEnent{
    @Subscribe
    public void subscribe(String str){
        //业务逻辑
        System.out.println("执行subscribe方法，传入的参数是:"+str);
    }
}

public class Client {
    public static void main(String[] args) {
        EventBus eventBus = new EventBus();
        GuavaEnent guavaEnent = new GuavaEnent();
        eventBus.register(guavaEnent);
        eventBus.post("Tom");
    }
}
